package com.doeis.uwork.entity;

import java.net.URLDecoder;
import java.sql.Timestamp;

import cn.jpush.api.utils.StringUtils;

import com.voland.core.annotation.Associate;
import com.voland.core.annotation.Table;
import com.voland.core.db.Entity;
import com.voland.core.validator.NotNull;

@Table(name="item_notes")
public class ItemNotes extends Entity implements Cloneable {

	private String id;
	@NotNull(message="指数Id不能为空")
	private String item_id;
	@NotNull(message="用户Id不能为空")
	private String user_id;
	private Timestamp creater_at;
	@NotNull(message="心得内容不能为空")
	private String content;
	private Integer type; 
	private String come_from;//从哪里添加的备注，客户端还是后台
	private String img; //图片存储   json 数组 
	private String designate;//@人
	
	@Associate
	private String user_name;
	@Associate
	private String head_pic;//用户头像
	@Associate
	private String item_name;
	@Associate
	private String shareid;
	@Associate
	private boolean textItem;
	@Associate
	private String belong_to;
	@Associate
	private String item_note_id;
	
	public String getDesignate() {
		return designate;
	}
	public void setDesignate(String designate) {
		this.designate = designate;
	}
	public String getItem_note_id() {
		return item_note_id;
	}
	public void setItem_note_id(String item_note_id) {
		this.item_note_id = item_note_id;
	}
	public String getBelong_to() {
		return belong_to;
	}
	public void setBelong_to(String belong_to) {
		this.belong_to = belong_to;
	}
	public String getImg() {
		return img;
	}
	public void setImg(String img) {
		this.img = img;
	}
	public boolean isTextItem() {
		return textItem;
	}
	public void setTextItem(boolean textItem) {
		this.textItem = textItem;
	}
	public String getItem_name() {
		return item_name;
	}
	public void setItem_name(String item_name) {
		this.item_name = item_name;
	}
	public String getShareid() {
		return shareid;
	}
	public void setShareid(String shareid) {
		this.shareid = shareid;
	}
	public String getUser_name() {
		return user_name;
	}
	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public String getId(){
		return id;
	}
	public void setId(String id){
		this.id = id;
	}

	public String getItem_id(){
		return item_id;
	}
	public void setItem_id(String item_id){
		this.item_id = item_id;
	}

	public String getUser_id(){
		return user_id;
	}
	public void setUser_id(String user_id){
		this.user_id = user_id;
	}

	public Timestamp getCreater_at(){
		return creater_at;
	}
	public void setCreater_at(Timestamp creater_at){
		this.creater_at = creater_at;
	}

	public String getContent(){
		if (StringUtils.isNotEmpty(content)) {
			try {
				content = URLDecoder.decode(content, "UTF-8");
			} catch (Exception e) {
				//content="";
			}
		}
		return content;
	}
	public void setContent(String content){
		this.content = content;
	}

	public String getHead_pic() {
		return head_pic;
	}
	public void setHead_pic(String head_pic) {
		this.head_pic = head_pic;
	}
	public String getCome_from() {
		return come_from;
	}
	public void setCome_from(String come_from) {
		this.come_from = come_from;
	}
	
	@Override
	public Object clone() throws CloneNotSupportedException {
		// TODO Auto-generated method stub
		return super.clone();
	}
	@Override
	public String toString(){
		return "ItemNotes ["+
			"id="+id+", item_id="+item_id+", "+
			"user_id="+user_id+", creater_at="+creater_at+", "+
			"content="+content+", " + 
			"toString()="+super.toString() +"]";
	}
}